package thread;


import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

class V implements Callable<Integer> {


    @Override
    public Integer call() throws Exception {

        int sum = 0;
        for (int i = 0; i < 100; i++) {
            if(i % 2 == 0) {
                sum = sum + i;
            }
        }
        System.out.println("执行完成！");

        return sum;
    }
}

public class CallableTest {

    public static void main(String[] args) {

        V data = new V();

        FutureTask<Integer> task = new FutureTask<>(data);

        Thread t = new Thread(task);

        t.start();



    }
}
